package com.acetech;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import tk.mybatis.spring.annotation.MapperScan;

@SpringBootApplication
@MapperScan(basePackages = {"com.acetech.**.mapper", "com.acetech.**.mapper"})
@ComponentScan(basePackages = "com.acetech")
@EnableScheduling       // 开启定时任务
public class AceTechAdminApplication extends SpringBootServletInitializer{

    public static void main(String[] args) {
        SpringApplication.run(AceTechAdminApplication.class, args);
    }

    /**
     * 用于部署war包
     */
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(AceTechAdminApplication.class);
    }

    /**
     * mybatis-plus分页插件
     * @return：PaginationInterceptor
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }

}
